<script setup>
import axios from 'axios';
import { ref } from 'vue'


// function baidu(){
//   window.location.href = "html/baidu.html"
//   // axios({
//   //   url:"http://192.168.210.217:8080/test",
//   //   params: {
//   //     "name": '䣘'
//   //   }
//   // })
//   // .then(response => response.data)
//   // .then(data => {
//   //   console.log(data);
//   // })
// }

const account = ref('')
const password = ref('')

  function  login(){
      // console.log(this.account)
      // console.log(this.password)
      // let url = 'http://47.120.69.214:8787/test/addPerson'
      // axios.post('url', {
      //   "account" : "account",
      //   "password" : "password"
      // })
      axios({
        method: 'post',
        url: 'http://47.120.69.214:8787/test/addPerson',
        data: {
          "account" : "account",
           "password" : "password"
        },
        headers: {
            "Content-Type": "application/json",
        }
      })
      .then(response => response.data)
      .then(data => {
        console.log(data);
      }).catch(function(error){
        console.log(error)
      })
    }

</script>

<template>
  <div class="center">

    <div>
        <text size="0.5">
          <h1 class="center" styple="padding:20px">登录页面</h1>
        </text>
    </div>

    <div>
      <span>
        账号:
      </span>
      <span>
        <input v-model.trim="account" type="text" name="account" placeholder="请输入账号">
      </span>
    </div>

    <div>
      <span>
        密码:
      </span>
      <span>
        <input v-model.trim="password" type="password" name="password" placeholder="请输入密码">
      </span>
    </div>


      <div class="center">
        <button @click="login()">
          登录
        </button>
      </div>

  </div>
</template>

<style>
.center{
  text-align: center;
}
.interval{
  margin-bottom: 30px;
}
div{
  margin-bottom : 20px;
}
</style>